﻿using System;

namespace VisualWip.Util
{
    public class ViewModelFactoryHandler
    {
        public ViewModelFactoryHandler(Func<object, bool> match, Type model, Type viewModel)
        {
            Match = match;
            Model = model;
            ViewModel = viewModel;
        }

        public Func<object, bool> Match { get; private set; }
        public Type Model { get; private set; }
        public Type ViewModel { get; private set; }

        public static ViewModelFactoryHandler Create<TModel, TViewModel>()
        {
            return Create<TModel, TViewModel>(param => param is TModel);
        }

        public static ViewModelFactoryHandler Create<TModel, TViewModel>(Func<object, bool> match)
        {
            return new ViewModelFactoryHandler(match, typeof (TModel), typeof (TViewModel));
        }
    }
}